
<%@page import="doantotnghiep.modelDTO.CabinetDTO"%>
<%@page import="doantotnghiep.modelDTO.ImportedDetailDTO"%>
<%@page import="doantotnghiep.modelDTO.MedicamentDTO"%>
<%@page import="java.util.HashMap"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@page import="java.util.ArrayList"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Thêm chi tiết lô dược phẩm</title>
<script>
 $(document).ready(function(){
	
	/* 	 $("#command").find("[id=dateOfManufacture]").each(function(){
	 		$(this).datepicker();
	 });
	  $("#command").find("[id=expirationDate]").each(function(){
		   $(this).datepicker();
	 }); */
	 $("#command").find("[id^=batch]").each(function(){
	 
 		//var batchID=$(this).attr('id');
		 $("#dateOfManufacture").datepicker();
		 $("#expirationDate").datepicker();
	});
});
 </script>
</head>
<body>
	<%
		HashMap<String, Object> importedDetailModel = (HashMap<String, Object>) request
				.getAttribute("importedDetailModel");
	%>
	<br>
	<br>
	<div align="center">
		<h1 style="color: blue;">THÊM CHI TIẾT CÁC LÔ HÀNG</h1>
		<br> <br>

		<p style="color: green; font-size: 15px; font-weight: bold;"></p>

		<br>

		<form:form method="POST">
			<table border="1">
				<tr>
					<th>STT</th>
					<th>Ngày sản xuất</th>
					<th>Ngày hết hạn</th>
					<th>Số Hiệu Lô</th>
					<th>Tủ</th>
				</tr>
				<%
						if (importedDetailModel != null) {
								ImportedDetailDTO importedDetailDTO = (ImportedDetailDTO) importedDetailModel
										.get("importedDetailDTO");
								if (importedDetailDTO != null) {
									for (int i = 0; i < importedDetailDTO
											.getNumberOfBatch(); i++) {
					%>
				<tr id="batch<%=i%>">

					<td><%=i+1 %></td>
					<td><input id="dateOfManufacture" /></td>

					<td><input id="expirationDate" /></td>
					<td><input id="batchIdentifyNumber" /></td>
					<td><select id="cabinet_ID">
							<%
			            if(importedDetailModel!=null){
   					    	 ArrayList<CabinetDTO> cabinetDTOs = (ArrayList<CabinetDTO>)importedDetailModel.get("cabinetDTOs");
   					   		 if(cabinetDTOs!=null){ 
   					         	for (int j = 0; j < cabinetDTOs.size(); j++) {			 
						   	 %>
							<option value="<%=cabinetDTOs.get(j).getId()%>"><%=cabinetDTOs.get(j).getCabinetName()%></option>
							<%}}}%>

					</select></td>
				</tr>
				<%
									}
												}
											}
								%>	
					
			</table>

		</form:form>
		<input id="addbatchsubmit" type="button" value="Xong" />
					<input id="addbatchcancel" type="button" value="Hủy" />
				
	</div>
	<br>
	<br>
	<br>
	<br>
	<br>
	<br>
</body>
</html>
